﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;
using MvcMusicStore.Models;

namespace MvcMusicStore.Controllers {
	public class StoreController : Controller {
		//数据库上下文
		private MusicStoreEntities storeDB = new MusicStoreEntities();
		//
		// GET: /Store/

		public ActionResult Index() {
			//List<Genre> genreList = new List<Genre> { 
			//    new Genre{ Name="Disco"},
			//    new Genre{ Name="Jazz"},
			//    new Genre{ Name="Rock"}
			//};
			//return View(genreList);
			var genres = storeDB.Genres.ToList();
			return this.View(genres);
		}

		public ActionResult Browse(string genre) {
			Genre genreModel = new Genre { Name=genre};
			return View(genreModel);
		}

		public ActionResult Details(int id=1) {
			Album album = new Album { Title="album "+id};
			return View(album);
		}

	}
}
